Xbasic

Office::SpreadsheetSetFormat Method

Syntax

.SetFormat as L (StartRow as N, StartColumn as N, EndRow as N, EndColumn as N, Format as P)

Arguments

StartRowNumeric

 

StartColumnNumeric

 

EndRowNumeric

 

EndColumnNumeric

 

FormatPointer

 

Returns

resultLogical

Returns .t. if the operation succeeds, otherwise .f..

Description

Set the format for a block of cells.

Discussion

The setFormat() method is used to assign a format to a block of cells in a spreadsheet. The format is defined as an Office::Format object, which must first be created using the addFormat() or getFormat() method for an [Office::ExcelDocument] or [Office::Excel2003Document] object.

Example

dim document as Office::ExcelDocument
		dim format as Office::Format = document.addFormat()

		format.FillPattern = Office::FillPattern::ReverseDiagonalStripe
		format.PatternBackgroundColor = Office::Color::DarkRed_CL
		format.PatternForegroundColor = Office::Color::Yellow
		dim spreadsheet as Office::Spreadsheet
		spreadsheet = document.addSheet("Fill Pattern")

		spreadsheet.setFormat(1,1,10,10,format)
		
		if (document.save("c:/excelDemo/fillPattern.xlsx") <> .t.) then
			showvar(document.CallResult,"Error Saving Document")
		end if

See Also